<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
	<!--<link rel="stylesheet" href="css/bootstrap.min.css" >-->
	<link rel="stylesheet" href="https://leanprover-community.github.io//css/lean.css" >
	<link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Merriweather:700">
    

	<script>
                function buildShortcutsForStructures(names) { 
                        const o = {}
                        names.forEach(name => o[name] = `\\mathbb\{${name}\}`)
                        return o
                }
		MathJax = {
			  tex: {
                                  macros: {
                                          ...buildShortcutsForStructures(["R", "Q", "Z", "N", "C"]),
                                  },
				      inlineMath: [['$', '$'], ['\\(', '\\)']]
				    },
		};
	</script>
	<script type="text/javascript" id="MathJax-script" async
		  src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
	</script>

	<title>Maths in Lean : p-adic numbers</title>
  </head>
  <body>
  <div id="wrapper">
  <nav class="navbar navbar-expand-lg navbar-light bg-gradient-light">
    <div class="d-flex flex-grow-1">
		<a class="navbar-brand" href="https://leanprover-community.github.io/index.html">Lean Community
    </a>
    </div>

    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse flex-grow-1 text-right" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto">
		
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
			  Try it!
          </a>
		  <div class="dropdown-menu " aria-labelledby="navbarDropdown">
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/lean-web-editor">Lean online</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/get_started.html">Install</a>
			
			
          </div>
        </li>
		
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
			  Learn
          </a>
		  <div class="dropdown-menu  dropdown-menu-right" aria-labelledby="navbarDropdown">
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/learn.html">Resources</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover.github.io/theorem_proving_in_lean/">Theorem proving in Lean</a>
			
			
			
			<a class="dropdown-item" href="http://wwwf.imperial.ac.uk/~buzzard/xena/natural_number_game/">The natural number game</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/mathlib-overview.html">Library overview</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/mathlib_docs">API documentation</a>
			
			
          </div>
        </li>
		
        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
			  Community
          </a>
		  <div class="dropdown-menu  dropdown-menu-right" aria-labelledby="navbarDropdown">
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/meet.html">Meet us</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover.zulipchat.com/">Zulip chat</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/meet.html#maintainers">Maintainers</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/contribute/index.html">How to contribute</a>
			
			
			
			<a class="dropdown-item" href="https://leanprover-community.github.io/papers.html">Papers</a>
			
			
          </div>
        </li>
		
      </ul>
    </div>
  </nav>
  <div class="container-sm mt-4">
	  
<h1 id="maths-in-lean--p-adic-numbers" class="markdown-heading">Maths in Lean : p-adic numbers <a class="hover-link" href="#maths-in-lean--p-adic-numbers">#</a></h1>
<p>The construction of <code>ℝ</code> using Cauchy sequences of rationals can be generalized to any absolute
value on <code>ℚ</code>. For any prime p, the completion of <code>ℚ</code> with repsect to the p-adic norm creates a field
<code>ℚ_p</code> and a ring <code>ℤ_p</code>.</p>
<ul>
<li><code>padic_norm.lean</code> defines the p-adic valuation <code>ℤ → ℕ</code>, extends it to <code>ℚ</code>, and defines
<code>padic_norm {p} : prime p → ℚ → ℚ</code>. Note that this does not lead to a useful instance of
<code>has_norm</code> since <code>p</code> cannot be inferred from the input, and it is not a norm for
composite <code>p</code>. <code>padic_norm</code> is shown to be a non-archimedean absolute value.</li>
<li>Fix <code>p</code> and <code>[fact p.prime]</code>. <code>padic_rationals.lean</code> defines <code>ℚ_[p]</code> as the Cauchy completion of
<code>ℚ</code> wrt <code>padic_norm p</code> using the same mechanisms as <code>data/real/basic.lean</code>. It is immediately a
field. The norm lifts to <code>padic_norm_e : ℚ_[p] → ℚ</code>, which is cast to <code>ℝ</code> and gives us a
<code>normed_field</code> instance. <code>ℚ_[p]</code> is shown to be Cauchy complete.</li>
<li><code>padic_integers.lean</code> defines <code>ℤ_[p]</code> as the subtype <code>{x : ℚ_[p] \\ ∥x∥ ≤ 1}</code>. It instantiates
<code>local_ring</code> and <code>normed_ring</code> and is Cauchy complete.</li>
<li><code>hensel.lean</code> proves Hensel's lemma over <code>ℤ_[p]</code>, described by Gouvêa (1997) as the &quot;most
important algebraic property of the p-adic numbers.&quot; For <code>F : polynomial ℤ_[p]</code> and <code>a : ℤ_[p]</code>
with <code>∥F.eval a∥ &lt; ∥F.derivative.eval a∥^2</code>, then there exists a unique <code>z</code> such that
<code>F.eval z = 0 ∧ ∥z - a∥ &lt; ∥F.derivative.eval a∥</code>; furthermore,
<code>∥F.derivative.eval z∥ = ∥F.derivative.eval a∥</code>. The proof is an adaptation of
<a href="http://www.math.uconn.edu/~kconrad/blurbs/gradnumthy/hensel.pdf">a writeup by Keith Conrad</a> and
uses Newton's method to construct a sequence in <code>ℤ_[p]</code> converging to the unique solution.</li>
</ul>

  </div>
</div>

  <nav class="footer navbar navbar-expand-lg navbar-light bg-light justify-content-end">
  <ul class="nav">
    <li class="nav-item">
      <a class="nav-link active" href="https://github.com/leanprover-community/leanprover-community.github.io/blob/newsite/templates/theories/padics.md">Suggest edits to this page on GitHub</a>
    </li>
  </ul>
</nav>

    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
    <script src="https://leanprover-community.github.io//js/bootstrap.min.js"></script>
    
  </body>
</html>